USE [vudu]
GO
/****** Object:  StoredProcedure [dbo].[EliminarPensum]    Script Date: 01/29/2012 13:54:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[EliminarMateriaPensum]

	@idPensum int,
	@idMateria int
AS
BEGIN

	SET NOCOUNT ON;
	delete from prelacion where ((fk_materia_actual = @idMateria and fk_pensum = @idPensum)
	or (fk_materia_prelacion = @idMateria and fk_pensum = @idPensum))

	DELETE FROM PensumMateria WHERE fk_id_pensum = @idPensum
	AND fk_id_materia =  @idMateria;

END